package cn.edu.ncut.cs.springboot.mybatisplusemployee.controller;

import cn.edu.ncut.cs.springboot.mybatisplusemployee.entity.Attendance;
import cn.edu.ncut.cs.springboot.mybatisplusemployee.service.IAttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ncut
 * @since 2024-12-25
 */
@RestController
@RequestMapping("/attendance")
public class AttendanceController {
    @Autowired
    private IAttendanceService attendanceService;

    @PutMapping("/saveOrUpdate")
    public boolean saveOrUpdate(@RequestBody Attendance attendance) {
            return attendanceService.saveOrUpdate(attendance);
    }

    @GetMapping("/list")
    public List<Attendance> list() {
        return attendanceService.list();
    }
    @DeleteMapping("/delete/{id}")
    public boolean deleteAttendance(@PathVariable Long id) {
        return attendanceService.removeAttendanceById(id);
    }
}
